drivers: Standardize I2C helper method naming.#67
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Standardizes internal I2C register access helper names across multiple drivers to improve consistency with the documented driver API conventions (ref: issue #61).
Changes:
- Renames per-driver I2C helper methods to
_read_reg()/_write_reg()(plus_read_reg16(),_write_reg16(),_read_block()where applicable). - Updates call sites throughout each driver to use the renamed helpers.
- Aligns several drivers more closely with the README “Driver API conventions” for private, snake_case I2C helpers.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/wsen-pads/wsen_pads/device.py | Renames register helpers to _read_reg / _write_reg and introduces _read_block naming. |
| lib/vl53l1x/vl53l1x/device.py | Renames VL53L1X register access helpers to private snake_case, including 16-bit variants. |
| lib/mcp23009e/mcp23009e/device.py | Renames _read_register / _write_register to _read_reg / _write_reg. |
| lib/lis2mdl/lis2mdl/device.py | Renames setReg / read_reg helpers to _write_reg / _read_reg and updates internal uses. |
| lib/hts221/hts221/device.py | Renames setReg / getReg / get2Reg helpers to _write_reg / _read_reg / _read_reg16. |
| lib/bq27441/bq27441/device.py | Renames i2cReadBytes / i2cWriteBytes helpers to _read_reg / _write_reg. |
| lib/apds9960/apds9960/device.py | Renames low-level APDS9960 I2C helpers to _read_reg / _write_reg / _read_block across base + MicroPython subclass. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🎉 This PR is included in version 0.0.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #61.
Standardizes I2C helper method names across all drivers to use
_read_reg()/_write_reg()(private, snake_case) as documented in the README conventions.Changes per driver
setReg,read_reg_write_reg,_read_regsetReg,getReg,get2Reg_write_reg,_read_reg,_read_reg16i2cReadBytes,i2cWriteBytes_read_reg,_write_reg_read_byte_data,_write_byte_data,_read_i2c_block_data_read_reg,_write_reg,_read_block_read_register,_write_register_read_reg,_write_regwriteReg,readReg,writeReg16Bit,readReg16Bit_write_reg,_read_reg,_write_reg16,_read_reg16_read_u8,_write_u8,_read_read_reg,_write_reg,_read_blockAlready compliant (no changes needed): wsen-hids, ssd1327 (display driver using
write_cmd/write_data).Test plan
ruff checkpasses (verified locally)